﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="New.aspx.cs" MasterPageFile="~/Site.Master" Inherits="Timesheet.WebForm.TimeSheets.New" %>

<%@ Register Assembly="DevExpress.Web.v14.2, Version=14.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %>




<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
    <div class="title">
        <dx:ASPxLabel ID="ASPxLabel4" CssClass="maintitle" runat="server" Text="New TimeSheet" Font-Size="22px" Font-Bold="true" ForeColor="#4A72A3">
        </dx:ASPxLabel>
    </div>
    <div>
        <dx:ASPxLabel ID="lblMessage" runat="server" Visible="false" Text="" Font-Size="16px" Font-Names="Calibri" ForeColor="Red">
        </dx:ASPxLabel>
    </div>    
    <dx:ASPxButton runat="server" ID="btnNew" Font-Bold="True" Font-Overline="False" Text="Create" OnClick="btnNew_Click" CssClass="tmshNew_btnNew"></dx:ASPxButton>    

    <div>
        <dx:ASPxFormLayout runat="server" Width="600px" CssClass="newtmshPanel" Theme="Office2010Silver" ID="newtmshPanel">
            <Items>
                <dx:LayoutItem Caption="Project"  FieldName="ProjectID" RequiredMarkDisplayMode="Hidden">
                    <LayoutItemNestedControlCollection>
                        <dx:LayoutItemNestedControlContainer runat="server">
                            <asp:Label runat="server" ViewStateMode="Disabled" ID="lblProjectID" CssClass="valuelbb"></asp:Label> 
                            <dx:ASPxComboBox Theme="Office2010Silver" Font-Size="16px" Font-Names="Calibri" 
                                TextField="ProjectName" ValueField="PrjID" ID="cbxProjectID" runat="server" Width="250px" AutoPostBack="True"
                        OnSelectedIndexChanged="cbxProjectID_SelectedIndexChanged"> </dx:ASPxComboBox>
                        </dx:LayoutItemNestedControlContainer>
                    </LayoutItemNestedControlCollection>
                </dx:LayoutItem>
                <dx:LayoutItem Caption="Team" FieldName="TeamID">
                    <LayoutItemNestedControlCollection>
                        <dx:LayoutItemNestedControlContainer runat="server" SupportsDisabledAttribute="True">
                            <asp:Label runat="server" ID="lblTeamID" CssClass="valuelbb"></asp:Label>
                            <dx:ASPxComboBox Theme="Office2010Silver" Font-Size="16px" Font-Names="Calibri" TextField="TeamName" ValueField="Id" ID="cbxTeam" runat="server"
                                 Width="250px"  ></dx:ASPxComboBox>
                        </dx:LayoutItemNestedControlContainer>
                    </LayoutItemNestedControlCollection>
                </dx:LayoutItem>
                <dx:LayoutItem Caption="Week" FieldName="Week">
                    <LayoutItemNestedControlCollection>
                        <dx:LayoutItemNestedControlContainer runat="server" SupportsDisabledAttribute="True">
                            <dx:ASPxDateEdit Theme="Office2010Silver" Font-Size="16px" Font-Names="Calibri" ID="fldWeek" runat="server" Width="250px" ClientVisible="True" HighlightWeekends="True" ViewStateMode="Enabled" FirstDayOfWeek="Sunday" ShowWeekNumbers="True" />
                        </dx:LayoutItemNestedControlContainer>
                    </LayoutItemNestedControlCollection>
                </dx:LayoutItem>

            </Items>
            <Paddings PaddingLeft="20px" />
        </dx:ASPxFormLayout>

          <asp:ObjectDataSource
                ID="dsPrjects"
                runat="server"
                DataObjectTypeName="Timesheet.Domain.Project"
                DeleteMethod="Delete"
                InsertMethod="Add"
                SelectMethod="GetProjects"
                TypeName="Timesheet.Service.IProjectService"
                UpdateMethod="Update"
                OnObjectCreating="dsPrjects_ObjectCreating">
                <SelectParameters>
                    <asp:SessionParameter DefaultValue="0" Name="userID" SessionField="UserId" DbType="String" />                    
                </SelectParameters>
            </asp:ObjectDataSource>

        <asp:ObjectDataSource
            ID="dsTeams"
            runat="server"
            UpdateMethod="Update"            
            DataObjectTypeName="Timesheet.Domain.Team"
            SelectMethod="GetTeamByUSers"
            TypeName="Timesheet.Service.ITeamService"
            OnObjectCreating="dsTeams_ObjectCreating">
            <SelectParameters>
                    <asp:SessionParameter DefaultValue="0" Name="userID" SessionField="UserId" DbType="String" />                    
                </SelectParameters>
        </asp:ObjectDataSource>
    </div>
    <script>
        $('#MainContent_newtmshPanel_0').find("label").text("Project");
        $('#MainContent_newtmshPanel_1').find("label").text("Team");
        $('#MainContent_newtmshPanel_2').find("label").text("Week");
    </script>
</asp:Content>
